﻿using System;
using Autodesk.Revit.DB;

namespace YJKAcquireDataComparison
{
	public class FetchDataRectangle
	{
		public XYZ LeftBottom { get; set; }

		public XYZ RightBottom { get; set; }

		public XYZ LeftTop { get; set; }

		public XYZ RightTop { get; set; }

		public bool IsZeroRect()
		{
			return this.LeftBottom.DistanceTo(this.LeftTop) < this.minLength && this.LeftTop.DistanceTo(this.RightTop) < this.minLength && this.RightTop.DistanceTo(this.RightBottom) < this.minLength && this.RightBottom.DistanceTo(this.LeftBottom) < this.minLength;
		}

		public override bool Equals(object obj)
		{
			FetchDataRectangle fetchDataRectangle = obj as FetchDataRectangle;
			return fetchDataRectangle != null && (this.RightTop.IsAlmostEqualTo(fetchDataRectangle.RightTop, this.tolerance) && this.LeftBottom.IsAlmostEqualTo(fetchDataRectangle.LeftBottom, this.tolerance) && this.RightBottom.IsAlmostEqualTo(fetchDataRectangle.RightBottom, this.tolerance)) && this.LeftTop.IsAlmostEqualTo(fetchDataRectangle.LeftTop, this.tolerance);
		}

		private double tolerance = 1E-06;

		private double minLength = 0.0026246719160104987;
	}
}
